<?php

if($dbprocess == 'newscreen' ){
	// Cosas para crear nuevo proyecto
	$newImageName=randomString($n=8);
	
	$file=uploadfile('screen', 'files/', $newImageName);
	
	if($file){
		$data=array();
		$data['wireframe_id'] = $_POST['wireframe_id'];
		$data['description'] = $_POST['description'];
		$data['create_at'] = date("Y-m-d");
		
		
		// Generar thumbnail
		$sizes=array(190,200);	// WIDTH ,  HEIGHT
		$forze='bouth';
		$margin=0;
		$ext=get_file_extension( $_FILES['screen']['name'] );
		$newImageName= $newImageName.".".$ext;
		
		$image=generate_scaled_image('files/'.$newImageName,$sizes,$forze,$margin,"files/thumb/");
		$data['file'] = $newImageName;
		
		$r=createScreen($data);
		
		if($r){
			$id=mysql_insert_id();
			$_SESSION['messages'][]="Wireframe actualizado.";
			header("Location:index.php?v=manage&id=".$_POST['proyect_id']);
		}else{
			$_SESSION['messages'][]="Error: ";
		}
	}else{
		$_SESSION['messages'][]="Error: No subio la imagen";
	}
}



?>